package net.lab1024.sa.admin.module.business.lcy.student.controller;

import net.lab1024.sa.admin.module.business.lcy.student.domain.form.LcyStudentAddForm;
import net.lab1024.sa.admin.module.business.lcy.student.domain.form.LcyStudentQueryForm;
import net.lab1024.sa.admin.module.business.lcy.student.domain.form.LcyStudentUpdateForm;
import net.lab1024.sa.admin.module.business.lcy.student.domain.vo.LcyStudentVO;
import net.lab1024.sa.admin.module.business.lcy.student.service.LcyStudentService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;

/**
 * 学生基本信息 Controller
 *
 * @Author yangz
 * @Date 2025-10-31 18:41:13
 * @Copyright yangz
 */

@RestController
@Tag(name = "学生基本信息")
public class LcyStudentController {

    @Resource
    private LcyStudentService lcyStudentService;

    @Operation(summary = "分页查询 @author yangz")
    @PostMapping("/lcyStudent/queryPage")
    @SaCheckPermission("lcyStudent:query")
    public ResponseDTO<PageResult<LcyStudentVO>> queryPage(@RequestBody @Valid LcyStudentQueryForm queryForm) {
        return ResponseDTO.ok(lcyStudentService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author yangz")
    @PostMapping("/lcyStudent/add")
    @SaCheckPermission("lcyStudent:add")
    public ResponseDTO<String> add(@RequestBody @Valid LcyStudentAddForm addForm) {
        return lcyStudentService.add(addForm);
    }

    @Operation(summary = "更新 @author yangz")
    @PostMapping("/lcyStudent/update")
    @SaCheckPermission("lcyStudent:update")
    public ResponseDTO<String> update(@RequestBody @Valid LcyStudentUpdateForm updateForm) {
        return lcyStudentService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author yangz")
    @PostMapping("/lcyStudent/batchDelete")
    @SaCheckPermission("lcyStudent:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return lcyStudentService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author yangz")
    @GetMapping("/lcyStudent/delete/{studentId}")
    @SaCheckPermission("lcyStudent:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long studentId) {
        return lcyStudentService.delete(studentId);
    }
}
